<?php

namespace common\models\patient;

use Yii;

/**
 * This is the model class for table "{{%patient_callback}}".
 *
 * @property int $id
 * @property int $project_id 项目ID
 * @property int $patient_user_id 用户患者ID
 * @property int $callback_state_id 回访状态ID（关联by_marketing_callback_status表）
 * @property string $callback_state 回访状态(冗余字段)
 * @property int $callback_way_id 回访方式【1：电话、2：微信、3：QQ】
 * @property string $content 回访内容
 * @property int $current_callback_time 本次回访时间
 * @property int $outpatient_type_id 就诊类型（关联by_marketing_outpatient_type）
 * @property int $next_callback_time 下次回访时间
 * @property int $next_fuzhen_time 下次复诊时间
 * @property int $member_id 回访人ID【member表ID】
 * @property string $member_name 回访人姓名(冗余字段)
 * @property string|null $member_departmement 回访人所属部门
 * @property int $status 状态【-1删除、0禁用、1启用】
 * @property int $dt_callback_id 灯塔回访表主键id
 * @property int $created_at 添加时间
 * @property int $updated_at 更新时间
 */
class Callback extends \common\models\BaseModel
{
    const STATUS_DELETE = -1;// 删除
    const STATUS_INVALID = 0;// 失效
    const STATUS_ENABLE = 1;// 正常

    const WAY_CALLBACK = [
        '电话' => self::CALLBACK_WAY_ID_TEL,
        '微信' => self::CALLBACK_WAY_ID_WECHAT,
        'QQ' => self::CALLBACK_WAY_ID_QQ,
        '其它' => self::CALLBACK_WAY_ID_OTHER,
    ];

    const CALLBACK_WAY_ID_TEL = 1;// 电话
    const CALLBACK_WAY_ID_WECHAT = 2;// 微信
    const CALLBACK_WAY_ID_QQ = 3;// QQ
    const CALLBACK_WAY_ID_OTHER = 4;// 其他

    public static $callbackWayIds = [
        self::CALLBACK_WAY_ID_TEL => '电话',
        self::CALLBACK_WAY_ID_WECHAT => '微信',
        self::CALLBACK_WAY_ID_QQ => 'QQ',
        self::CALLBACK_WAY_ID_OTHER => '其它',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%patient_callback}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['project_id', 'patient_user_id', 'callback_state_id', 'callback_way_id', 'current_callback_time', 'outpatient_type_id', 'next_callback_time', 'next_fuzhen_time', 'member_id', 'status', 'created_at', 'updated_at'], 'integer'],
            [['content'], 'required'],
            [['content'], 'string'],
            [['callback_state', 'member_name', 'member_departmement'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'project_id' => '项目ID',
            'patient_user_id' => '用户患者ID',
            'callback_state_id' => '回访状态ID（关联by_marketing_callback_status表）',
            'callback_state' => '回访状态(冗余字段)',
            'callback_way_id' => '回访方式【1：电话、2：微信、3：QQ】',
            'content' => '回访内容',
            'current_callback_time' => '本次回访时间',
            'outpatient_type_id' => '就诊类型（关联by_marketing_outpatient_type）',
            'next_callback_time' => '下次回访时间',
            'next_fuzhen_time' => '下次复诊时间',
            'member_id' => '回访人ID【member表ID】',
            'member_name' => '回访人姓名(冗余字段)',
            'member_departmement' => '回访人所属部门',
            'status' => '状态【-1删除、0禁用、1启用】',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
        ];
    }
}
